import request from '@/utils/request.js'
import store from '@/store/index.js'
export function authorization(data) {

  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data,
    noToken:true
  })
}
//短信验证
export function smsCodes(mobile){
  return request ({
    url:`/v1_0/sms/codes/${mobile}`
  })
}
//个人用户资料
export function userProfile(){
  return request ({
    url:'/v1_0/user/profile'
  })
}
//
export function userProfilePatch(data){
  return request({
    url:'/v1_0/user/profile',
    method:'PATCH',
    data
  })
}
//用户头像数据
export function  userPhotoPatch(data){
  return request({
    url:'/v1_0/user/photo',
    method:'PATCH',
    data
  })
}
//刷新用户token
export function authorizationsPut(){
  return request({
    url:'/v1_0/authorizations',
    method:'put',
    noToken:true,
    headers:{
      Authorization:`Bearer ${store.state.user.refresh_token}`
    }
  })
}